Skip to main content

Partitions

Compositions

Definition

A sequence (a1,a2,,ak)\left(a_1, a_2, \cdots, a_k\right) of integers fulfilling ai0a_i \geq 0 for all ii, and (a1+a2++ak)=n\left(a_1+a_2+\cdots+a_k\right)=n is called a weak composition of nn. If, in addition, the aia_i are positive for all i[k]i \in[k], then the sequence (a1,a2,,ak)\left(a_1, a_2, \cdots, a_k\right) is called a composition of nn.

Theorem

For all positive integers nn and kk, the number of weak compositions of nn into kk parts is

(n+k1k1)=(n+k1n).\left(\begin{array}{c} n+k-1 \\ k-1 \end{array}\right)=\left(\begin{array}{c} n+k-1 \\ n \end{array}\right) .

Proof

The problem is certainly equivalent to counting the number of ways of putting nn identical balls into kk different boxes. Place the kk boxes in a line, then place the balls in them in some way and align them in the middle of the boxes. This creates a long line consisting of nn balls and k1k-1 walls separating the kk boxes from each other. Note that simply knowing in which order the nn identical balls and k1k-1 separating walls follow each other is the same as knowing the number of balls in each box. So our task is reduced to finding the number of ways to permute the multiset consisting of nn balls and k1k-1 walls. This number is

(n+k1)!n!(k1)!\frac{(n+k-1) !}{n ! \cdot(k-1) !}

Corollary 1

For all positive integers nn and kk, the number of compositions of nn into kk parts is (n1k1)\left(\begin{array}{c}n-1 \\ k-1\end{array}\right).

Proof

What if a grandparent insists on giving at least one ball to each child? The problem is not any harder. First we can give one ball to each child, then give away the remaining 16 balls to the four children in any of (16+4141)=\left(\begin{array}{c}16+4-1 \\ 4-1\end{array}\right)= (193)\left(\begin{array}{c}19 \\ 3\end{array}\right) ways. The generalization of this argument to nn balls and kk children is the following statement.

Corollary 2

For all positive integers n, the number of all compositions of nn is 2n12^{n-1}.

Proof 1

A composition of nn will have at least one and at most nn parts. So the total number of compositions of nn is

k=1n(n1k1)=2n1\sum_{k=1}^n\left(\begin{array}{l} n-1 \\ k-1 \end{array}\right)=2^{n-1}

Indeed, the left-hand side is the number of all subsets of [n1][n-1], first enumerated by their size kk, and then summed over k[n]k \in[n].

Proof 2

We prove the statement by induction on nn. For n=1n=1, the statement is true as the integer 1 has one composition. Now assume that the statement is true for nn, and take all 2n12^{n-1} compositions of nn. For each such composition CC, we will define two different compositions of n+1n+1. First, add one to the first element of CC. This way we get a composition of n+1n+1 with the first element at least 2. Second, take CC, and write an additional 1 to its front. This way we get a composition of n+1n+1 with first element 1 . It is clear that different compositions of nn lead to different compositions of n+1n+1 this way. Each decomposition of n+1n+1 can be obtained in exactly one of these two ways. Therefore, it follows that n+1n+1 has twice as many compositions as nn, which was to be proved.

Set Partitions

Definition

A partition of the set [n][n] is a collection of non-empty blocks so that each element of [n][n] belongs to exactly one of these blocks.

The number of partitions of [n][n] into kk nonempty blocks is denoted by S(n,k)S(n, k). The numbers S(n,k)S(n, k) are called the Stirling numbers of the second kind.

Theorem

For all positive integers knk \leq n,

S(n,k)=S(n1,k1)+kS(n1,k).S(n, k)=S(n-1, k-1)+k \cdot S(n-1, k) .

Proof

As before, we can obtain a combinatorial proof by taking a close look at one particular element, say the maximum element nn. If this element forms a singleton block, then the remaining n1n-1 elements have exactly S(n1,k1)S(n-1, k-1) ways to complete the partition. These partitions are enumerated by the first member of the right-hand side. If, on the other hand, the element nn does not form a block by itself, then the remaining n1n-1 elements must form a partition with kk blocks in one of S(n1,k)S(n-1, k) ways. Then we can add nn into any of the kk blocks formed by this partition, multiplying the number of all our possibilities by kk. These partitions are enumerated by the second member of the right-hand side. As the left-hand side enumerates all partitions of [n][n] into kk blocks, the claim is proved.

Corollary 1

The number of all surjective functions f:[n][k]f:[n] \rightarrow[k] is k!S(n,k)k ! \cdot S(n, k).

Proof

Such a function defines a partition of [n][n]. The blocks are the subsets of elements that are mapped into the same element i[k]i \in[k]. Therefore, the blocks are labeled, and there are exactly kk of them, so the proof follows from the previous paragraph.

An interesting consequence of this is the following unexpected corollary. It is surprising as it shows that xnx^n, this very compact expression, is in fact a sum of n+1n+1 terms involving Stirling numbers.

Corollary 2

For all real numbers xx, and all non-negative integers nn,

xn=k=0nS(n,k)(x)k.x^n=\sum_{k=0}^n S(n, k)(x)_k .

Proof

Both sides are polynomials of xx of degree nn. So if we can show that they agree for more than nn values of xx, we will be done. We will prove an even stronger statement, namely that the two sides agree for all positive integers xx.

So let xx be a positive integer. Then the left-hand side is the number of all functions from [n][n] to [x][x]. We claim that the right-hand side is the same, enumerated according to the size of the image. Indeed, if the image of such a function is of size kk, then there are (xk)\left(\begin{array}{l}x \\ k\end{array}\right) choices for the image II, then, by Corollary 1, there are k!S(n,k)k ! \cdot S(n, k) choices for the function itself. As (x)k=k!(xk)(x)_k=k ! \cdot\left(\begin{array}{l}x \\ k\end{array}\right), the claim is proved.

Another way of extending our enumeration of partitions is by enumerating all partitions, without restricting the number of parts.

Definition

The number of all set partitions of [n][n] into nonempty parts is denoted by B(n)B(n), and is called the nnth Bell number. We also set B(0)=1B(0)=1

So B(n)=i=0nS(n,i)B(n)=\sum_{i=0}^n S(n, i). The Bell numbers also satisfy a nice recurrence relation.

Theorem

For all non-negative integers n,

B(n+1)=i=0n(ni)B(i).B(n+1)=\sum_{i=0}^n\left(\begin{array}{l} n \\ i \end{array}\right) B(i) .

Proof

We must prove that the right-hand side enumerates all partitions of [n+1][n+1]. Let us assume the element n+1n+1 is in a block of size ni+1n-i+1. Then there are ii elements that are not in the same block as n+1n+1. Therefore, there are (ni)\left(\begin{array}{l}n \\ i\end{array}\right) ways to choose these elements, and then there are B(i)B(i) ways to partition them. Summing over all possible values of ii, we get the statement of the theorem.

Integer Partitions

Definition

Let a1a2ak1a_1 \geq a_2 \geq \cdots \geq a_k \geq 1 be integers so that a1+a_1+ a2++ak=na_2+\cdots+a_k=n. Then the sequence (a1,a2,,ak)\left(a_1, a_2, \cdots, a_k\right) is called a partition of the integer nn. The number of all partitions of nn is denoted by p(n)p(n). The number of partitions of nn into exactly kk parts is denoted by pk(n)p_k(n).

Definition

A partition of n is called self-conjugate if it is equal to its conjugate.

Theorem

The number of partitions of nn into at most kk parts is equal to that of partitions of nn into parts not larger than kk.

Proof

The first number is equal to that of Ferrers shapes of size nn with at most kk rows. The second number is equal to that of Ferrers shapes with at most kk columns. Finally, these two sets of Ferrers shapes are equinumerous as one can see by taking conjugates.

Theorem

The number of partitions of nn into distinct odd parts is equal to that of all self-conjugate partitions of nn.

Proof

We define a bijection ff from the set of self-conjugate partitions of nn onto that of partitions of nn into distinct odd parts as follows. Take any self-conjugate partition π=(π1,π2,,πt)\pi=\left(\pi_1, \pi_2, \cdots, \pi_t\right) of nn. Take its Ferrers shape, and remove all the boxes from its first row and first column. As π\pi is self-conjugate, this means removing 2π112 \pi_1-1 boxes. Set f(π)1=2π11f(\pi)_1=2 \pi_1-1, that is, make the first part of the image of π\pi of size 2π112 \pi_1-1. Then continue this way. That is, remove the first row and column of the remaining Ferrers shape. This means removing 2π232 \pi_2-3 boxes. So set f(π)2=2π23f(\pi)_2=2 \pi_2-3. Continue this way until the entire Ferrers shape is removed. The resulting partition will be of the form f(π)=(2π11,2π23,,2πi(2i1),)f(\pi)=\left(2 \pi_1-1,2 \pi_2-3, \cdots, 2 \pi_i-(2 i-1), \cdots\right). So it will indeed be a partition of nn into odd parts, and the parts will all be distinct, as we had π1π2πt\pi_1 \geq \pi_2 \geq \cdots \geq \pi_t. We note that the set of all boxes consisting of one fixed box bb, all boxes below bb, and all boxes on the right of bb, is often called a hook. Using this terminology, we can say that in each step of our algorithm, we remove the hook of the box that is currently in the top left corner of our Ferrers shape.

To see that ff is a bijection, it suffices to prove that for any partition α\alpha of nn into distinct odd parts, there exists exactly one self-conjugate partition π\pi of nn so that f(π)=αf(\pi)=\alpha. Indeed, let α=(2a11,2a23,,2au(2u1))\alpha=\left(2 a_1-1,2 a_2-3, \cdots, 2 a_u-(2 u-1)\right). Then it follows from the definition of ff that if f(π)=αf(\pi)=\alpha, then the first row and column of π\pi must each contain a1a_1 boxes, the second row and second column of π\pi must each contain a2a_2 additional boxes, and so on. So we can build up the unique Ferrers shape whose partition has image α\alpha, proving our claim.